package com.fahai.web.dao;


import com.fahai.common.CommonMapper;
import com.fahai.web.entity.MpayflowVO;
import com.fahai.web.entity.QbyeVO;
import com.fahai.web.entity.UserInfo;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.provider.SpecialProvider;

import java.util.List;
import java.util.Map;

/**
 * 用户管理的视图
 */

@Repository
public interface UserInfoDao extends CommonMapper<UserInfo> {

    @Options(useGeneratedKeys = true, keyProperty = "userid")
    @InsertProvider(type = SpecialProvider.class, method = "dynamicSQL")
    int insertUseGeneratedKeys(UserInfo userInfo);

    /**
     * 多表的查询 动态的添加不好使 用sql拼接
     * @param
     * @return
     */
    public List selectAlla(Map<String, Object> map);/**
     * 获取总页数
     * @param
     * @return
     */
    public int getCount(Map<String, Object> map);


    /**
     * 查询用户余额
     * @param userId
     * @return
     */
    public List<QbyeVO> getWalletBalance(Integer userId);
    /**
     * 查询M站消费记录
     * @param userId
     * @return
     */
    public List<MpayflowVO> getMpayFlowVOs(Integer userId);
    /**
     * 查询M站消费记录
     * @param userId
     * @return
     */
    public List<MpayflowVO> getWxConsumption(Integer userId);
    /**
     * 查询M站充值记录
     * @param userId
     * @return
     */
    public List<MpayflowVO> getPaymz(Integer userId);
    /**
     * 查询微信充值记录
     * @param userId
     * @return
     */
    public List<MpayflowVO> getPaywx(Integer userId);

    /**
     * 更新备注
     */
    public void updateRemark(Map<String,Object> map);


    /**
     * 查询日增用户量，按照小时排序
     * @return
     */
    public List<Map<String,Object>> selectChartForHours(@Param(value = "registerTime")String registerTime);

    /**
     * 查询日增用户量，按照每天排序
     * @return
     */
    public List<Map<String,Object>> selectChartForDays(@Param(value = "registerTime")String registerTime);



    /**
     * 查询日增用户量，按照月份排序
     * @return
     */
    public List<Map<String,Object>> selectChartForMonths(@Param(value = "registerTime")String registerTime);


}